<template>
    <div class="san_box">

    </div>
</template>

<script>
import * as echarts from 'echarts'
export default {
    props: ['list'],
    data() {
        return {
            echartList: []
        }
    },
    methods: {
        async getEchartList(item) {
            // this.echartList = res.year
            // console.log(this.echartList);
            console.log(item,"item")
            let b = echarts.init(document.querySelector('.san_box'))
            let option = {
                xAxis: {
                    type: 'category',
                    data: item.map(val =>val['name']),
                    axisLine: {
                        lineStyle: {
                            color: "#ccc",
                            type: "dashed"
                        }
                    }
                },
                tooltip: {
                    show: true,
                    trigger: "item"
                },
                color: [
                    {
                        type: 'linear',
                        x: 0,
                        y: 0,
                        x2: 0,
                        y2: 1,
                        colorStops: [{
                            offset: 0, color: '#3ed59f' // 0% 处的颜色
                        }, {
                            offset: 1, color: '#cdf4e6' // 100% 处的颜色
                        }],
                        global: false // 缺省为 false
                    },
                    {
                        type: 'linear',
                        x: 0,
                        y: 0,
                        x2: 0,
                        y2: 1,
                        colorStops: [{
                            offset: 0, color: '#4ca1ee' // 0% 处的颜色
                        }, {
                            offset: 1, color: '#d1e7fa' // 100% 处的颜色
                        }],
                        global: false // 缺省为 false
                    }
                ],

                yAxis: {
                    type: 'value',
                    splitLine: {
                        lineStyle: {
                            color: "#ccc",
                            type: "dashed"
                        }
                    }
                },
                series: [
                    {
                        name: "期望薪资",
                        // hope_salary
                        data:  item.map(val => {
                            return val['hope_salary']
                        }),
                        type: 'bar',
                    },
                    {
                        name: "实际薪资·",
                        data: item.map(val => {
                            return val['salary']
                        }),
                        type: 'bar',
                    },
                ]
            };
            b.setOption(option)
        }
    },
}
</script>

<style>
.san_box {
    width: 100%;
    height: 100%;
}
</style>